import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

public class work2 {
    public static void merge(int[] nums1, int m, int[] nums2, int n) {
        List<Integer> num=new ArrayList<Integer>();
        for(int i=0;i<m;i++){
                num.add(nums1[i]);
        }
        for (int i = 0; i <n ; i++) {
            num.add(nums2[i]);
        }
        num.sort(Comparator.naturalOrder());
        System.out.println(num.toString());
    }
    public static void merge1(int[] nums1, int m, int[] nums2, int n) {
        for (int i = 0; i <n ; i++) {
            nums1[m+i]=nums2[i];
        }
        Arrays.sort(nums1);
        System.out.println(Arrays.toString(nums1));
    }

    public static void main(String[] args) {
         int []nums1={1,2,3,0,0,0};
         int []nums2={2,5,6};
         int n=3;
         int m=3;
         merge1(nums1,m,nums2,n);
    }
}
